package songjianjun;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class one {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String min = scan.nextLine();
        String str = scan.nextLine();
        String ti = scan.nextLine();
        System.out.println(min);
        System.out.println(str);
        System.out.println(ti);
        scan.close();
        char [] ch = new char[128];
        for (int i = 0; i < min.length(); i++) {
            ch[min.charAt(i)]++;
        }
        String res = "";
        char [] temp = new char[128];
        for (int i = 0; i < str.length(); i++) {
            if(min.contains(String.valueOf(str.charAt(i)))){
                int j=1;
                temp[str.charAt(i)]++;
                i++;
                String s = String.valueOf(str.charAt(i));
                while(j<min.length()){
                    System.out.println(j);
                    if(min.contains(String.valueOf(str.charAt(i)))) {

                        if (temp[str.charAt(i)] < ch[str.charAt(i)]) {
                            temp[str.charAt(i)]++;
                            j++;
                            i++;
                            s += str.charAt(i);
                        }else{
                            res+=s;
                            break;
                        }
                    }else{
                        res +=s;
                        j = min.length()+1;
                    }
                }
                if(Arrays.equals(ch,temp)){
                    temp = new char[128];
                    res+= ti;
                }


            }else{
                res +=String.valueOf(str.charAt(i));
            }

        }
        System.out.println(res);
    }
}
